# Create your views here.
from django.shortcuts import render_to_response
from django.http import HttpResponseRedirect
from data.models import Order, OrderItem, Table

def index(request, order_id):
    item = Order.objects.get(pk=order_id)
    item = item.orderitem_set.get(order=order_id)
    Table.objects.filter(id=item.table.id).update(is_free=True)
    Order.objects.filter(pk=order_id).delete()
    return HttpResponseRedirect("/kitchen")

